<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<div id="tool-bar">
	
	<!-- 顶层菜单 -->
	<div id="menu-bar">
		<ul>
			<li><s:a id="sys-home" href="#">系统主页</s:a></li>
			<li><s:a href="#">Blog</s:a></li>
			<li><s:a href="#">Photos</s:a></li>
			<li><s:a href="#">Contact</s:a></li>
			<li><s:a href="#">FAQ</s:a></li>
			<li><s:a href="#">About</s:a></li>
			<li><s:a id="sys-mng" href="#">系统管理</s:a></li>
		</ul>
	</div>
	
	<!-- 搜索工具条-->
	<div id="search-bar">
		<form method="get" action="">
			<input type="text" name="s" id="search-text" size="10" />
			<input type="submit" id="search-submit" value="GO" />
		</form>
	</div>
	
</div>

<script type="text/javascript">
	$(document).ready(function(){
		var topMenuId = '<%=session.getAttribute("topMenuId")%>';
		//怎么判空？？？？
		//alert(topMenuId);
		//alert(topMenuId == "");
		//alert(topMenuId==null);
		if(topMenuId == "" || topMenuId == "null"){
			topMenuId="sys-home";
		}
		
		
		$("#"+topMenuId).parent().addClass("current_selected_page_item");
		
		$("#menu-bar a").each(function(){
			//鼠标掠过事件
			$(this).hover(
				function(){$(this).parent().addClass("current_hovered_page_item");},
				function(){$(this).parent().removeClass("current_hovered_page_item");}
			);
			//鼠标单击事件
			$(this).click(function(){
				//先清除原来选中tab页面
				$(".current_selected_page_item").each(function(){
					$(this).removeClass("current_selected_page_item");
				});
				//再将当前tab页面设为选中页面
				$(this).parent().addClass("current_selected_page_item");	
				
				//调用事件
				var href = "/snail/menu/queryTreeMenuAction.action?topMenuId="+$(this).attr("id");
				$(this).attr("targets", "side-menu").attr("href", href);
			});
		});
	});
	
	
</script>

